home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-12-08 | 44.8 KB | 1,233 lines | [TEXT/R*ch] |
- C.S.M.P. Digest Tue, 04 Aug 92 Volume 1 : Issue 160
-
- Today's Topics:
-
- Walking the catalog b-tree...
- Drawing with the mouse
- Converting floats to strings Question
- SOUND: Volume decreases after first command
- Programmers Switch/Handles
- Calling Apple Events from an Init/CDEV?
-
-
-
- The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly.
-
- The digest is a collection of article threads from the internet newsgroup
- comp.sys.mac.programmer. It is designed for people who read c.s.m.p. semi-
- regularly and want an archive of the discussions. If you don't know what a
- newsgroup is, you probably don't have access to it. Ask your systems
- administrator(s) for details. (This means you can't post questions to the
- digest.)
-
- Each issue of the digest contains one or more sets of articles (called
- threads), with each set corresponding to a 'discussion' of a particular
- subject. The articles are not edited; all articles included in this digest
- are in their original posted form (as received by our news server at
- cs.uoregon.edu). Article threads are not added to the digest until the last
- article added to the thread is at least one month old (this is to ensure that
- the thread is dead before adding it to the digest). Article threads that
- consist of only one message are generally not included in the digest.
-
- The entire digest is available for anonymous ftp from ftp.cs.uoregon.edu
- [128.223.8.8] in the directory /pub/mac/csmp-digest. Be sure to read the
- file /pub/mac/csmp-digest/README before downloading any files. The most
- recent issues are available from sumex-aim.stanford.edu [36.44.0.6] in the
- directory /info-mac/digest/csmp. If you don't have ftp capability, the sumex
- archive has a mail server; send a message with the text '$MACarch help' (no
- quotes) to LISTSERV@ricevm1.rice.edu for more information.
-
- The digest is also available via email. Just send a note saying that you
- want to be on the digest mailing list to mkelly@cs.uoregon.edu, and you will
- automatically receive each new issue as it is created. Sorry, back issues
- are not available through the mailing list.
-
- Send administrative mail to mkelly@cs.uoregon.edu.
-
-
- -------------------------------------------------------
-
- From: dirty@engin.umich.edu (Cameron Esfahani)
- Subject: Walking the catalog b-tree...
- Date: 13 Jun 92 03:21:35 GMT
- Organization: caen
-
- Pity me...I have figured that the only way that I can find a file if
- I just have it's file reference number and volume reference number
- is to open the catalog tree file on the volume and search through it.
- Now, IM-IV is very, very bad in explaining simple things such as the
- size of the nodes in the catalog b-tree. Does anyone out there have
- any information, code, suggestions on how to do this? I have
- written a simple app which opens the catalog tree file up, but I don't
- see any recognizable information until about 500 bytes into the buffer...
- Does anyone know anything about this?
-
-
- Thanks,
-
- Cameron Esfahani
- dirty@engin.umich.edu
-
- +++++++++++++++++++++++++++
-
- From: keith@taligent.com (Keith Rollin)
- Date: 15 Jun 92 20:10:08 GMT
- Organization: Taligent
-
- In article <mN--2z=@engin.umich.edu>, dirty@engin.umich.edu (Cameron Esfahani)
- writes:
- >
- > Pity me...I have figured that the only way that I can find a file if
- > I just have it's file reference number and volume reference number
- > is to open the catalog tree file on the volume and search through it.
- > Now, IM-IV is very, very bad in explaining simple things such as the
- > size of the nodes in the catalog b-tree. Does anyone out there have
- > any information, code, suggestions on how to do this? I have
- > written a simple app which opens the catalog tree file up, but I don't
- > see any recognizable information until about 500 bytes into the buffer...
- > Does anyone know anything about this?
-
- You shouldn't have to open up the catalog file yourself. Either use PBCatSearch
- (under 7.0) or use the routine shown in Mac Technote #68.
-
- So why is it that you only have the file's ID number and vRefNum? Why don't you
- have it's dirID?
-
- - --
- Keith Rollin
- Phantom Programmer
- Taligent, Inc.
-
-
- +++++++++++++++++++++++++++
-
- From: Cameron Esfahani <dirty@engin.umich.edu>
- Date: Mon, 15 Jun 92 23:30:10 EDT
- Organization: caen
-
- >You shouldn't have to open up the catalog file yourself. Either use
- PBCatSearch
- >(under 7.0) or use the routine shown in Mac Technote #68.
- >
- >So why is it that you only have the file's ID number and vRefNum? Why
- don't you
- >have it's dirID?
- >
- >--
- >Keith Rollin
- >Phantom Programmer
- >Taligent, Inc.
-
- I have figured out how to find out what is currently selected in the
- Finder. However, at the place I do my "thing", I only have the file
- reference number, volume reference number, name, type and creator
- available to me. I have found a solution to my problem however, I just
- use PBCatSearch to search on name, type, and creator on the volume.
- I then ues PBGetCatInfo to compare all the file reference numbers.
- Cameron "Make Mine a 99" Esfahani
- dirty@engin.umich.edu
-
- +++++++++++++++++++++++++++
-
- From: Cameron Esfahani <dirty@engin.umich.edu>
- Date: Mon, 15 Jun 92 23:31:15 EDT
- Organization: caen
-
- >You shouldn't have to open up the catalog file yourself. Either use
- PBCatSearch
- >(under 7.0) or use the routine shown in Mac Technote #68.
- >
- >So why is it that you only have the file's ID number and vRefNum? Why
- don't you
- >have it's dirID?
- >
- >--
- >Keith Rollin
- >Phantom Programmer
- >Taligent, Inc.
-
- I have figured out how to find out what is currently selected in the
- Finder. However, at the place I do my "thing", I only have the file
- reference number, volume reference number, name, type and creator
- available to me. I have found a solution to my problem however, I just
- use PBCatSearch to search on name, type, and creator on the volume.
- I then ues PBGetCatInfo to compare all the file reference numbers.
- Cameron "Make Mine a 99" Esfahani
- dirty@engin.umich.edu
-
- +++++++++++++++++++++++++++
-
- From: David R. Falkenburg <falken@engin.umich.edu>
- Date: Tue, 16 Jun 92 11:19:10 EDT
- Organization: University of Michigan College of Engineering
-
- >In article <mN--2z=@engin.umich.edu>, dirty@engin.umich.edu (Cameron
- Esfahani)
- >writes:
- >>
- >> Pity me...I have figured that the only way that I can find a file if
- >> I just have it's file reference number and volume reference number
- >> is to open the catalog tree file on the volume and search through it.
- >> Now, IM-IV is very, very bad in explaining simple things such as the
- >> size of the nodes in the catalog b-tree. Does anyone out there have
- >> any information, code, suggestions on how to do this? I have
- >> written a simple app which opens the catalog tree file up, but I don't
- >> see any recognizable information until about 500 bytes into the
- buffer...
- >> Does anyone know anything about this?
-
- You DON'T want to walk th B-Trees yourself. Trust me.
-
- If you've got a "file number", why not try _GetFCBInfo... See IM-IV-179.
-
- This better be a good hack
-
- - -dave falkenburg
- university of michigan, college of engineering
-
- - --dave falkenburg
- - --university of michigan college of engineering
- - --falken@engin.umich.edu
-
- +++++++++++++++++++++++++++
-
- From: ewylie@ocf.berkeley.edu (Elizabeth Wylie)
- Date: 17 Jun 1992 00:51:27 GMT
- Organization: U. C. Berkeley Open Computing Facility
-
- The problem with GetFCBInfo is that it will only find the file if it is open. A
- n undocumented feature of PBGetCatInfo allows you to pass a file number in the
- ioDirID field. Since this is undocumented, it could fail in the future, but
- because of the way the disk catalog is set up, I'd be surprised if it did.
-
- If you are talking about file reference unmbres, then GetFCBInfo is the way to
- go.
-
- (Why do you only have the file number?!)
-
- - -E. Wylie
-
-
- +++++++++++++++++++++++++++
-
- From: buckeye@spf.trw.com (John Wallace)
- Date: 25 Jun 92 18:18:19 GMT
- Organization: TRW Data Systems Center, Redondo Beach, CA
-
- In article <11m2afINNr0k@agate.berkeley.edu> ewylie@ocf.berkeley.edu (Elizabeth Wylie) writes:
- >An undocumented feature of PBGetCatInfo allows you to pass a file number in the
- >ioDirID field. Since this is undocumented, it could fail in the future, but
- >because of the way the disk catalog is set up, I'd be surprised if it did.
- >
- >-E. Wylie
- >
-
- InsideMac-IV claims that if you pass in a dirId in ioDirId and a -1
- in ioDirIndex that it will return information about a directory. I've
- tried the same thing with passing a fileId in the ioDirId field, and
- it failed. My understanding is that it isn't possible for the B-tree
- to provide access using fileIds because of the way it stores the data.
- Am I (hopefully) wrong?
-
- Thanks!
- John
-
- +++++++++++++++++++++++++++
-
- From: heksterb@cs.utwente.nl (Ben Hekster)
- Organization: University of Twente, Dept. of Computer Science
- Date: Fri, 26 Jun 1992 03:33:15 GMT
-
- In article <11m2afINNr0k@agate.berkeley.edu> ewylie@ocf.berkeley.edu (Elizabeth Wylie) writes:
- >An undocumented feature of PBGetCatInfo allows you to pass a file number in the
- >ioDirID field. Since this is undocumented, it could fail in the future, but
- >because of the way the disk catalog is set up, I'd be surprised if it did.
- >
- >-E. Wylie
-
- In article <2A4A0DEB.46B6@deneva.sdd.trw.com> buckeye@spf.trw.com (John Wallace) writes:
- >
- >InsideMac-IV claims that if you pass in a dirId in ioDirId and a -1
- >in ioDirIndex that it will return information about a directory. I've
- >tried the same thing with passing a fileId in the ioDirId field, and
- >it failed. My understanding is that it isn't possible for the B-tree
- >to provide access using fileIds because of the way it stores the data.
- >Am I (hopefully) wrong?
-
- I hope you are (and I am, too). I tried it and it didn't work for me,
- either. It's unfortunate, because it would have been much nicer to use
- PBGetCatInfo for files and directories alike, instead of PBResolveFileID
- for files.
-
- However, PBGetCatInfo *will* return both file and directory
- IDs in ioDirID.
-
- Ah, well.
-
- - --
- Ben `Hackster' Hekster | "He bides his time and thinks,
- heksterb@cs.utwente.nl | 'There must be more to life than this!'"
-
- +++++++++++++++++++++++++++
-
- From: absurd@applelink.apple.com (Tim Dierks, software saboteur)
- Date: 1 Jul 92 17:49:45 GMT
- Organization: MacDTS Misfits
-
- In article <2A4A0DEB.46B6@deneva.sdd.trw.com>, buckeye@spf.trw.com (John Wallace) writes:
- >
- > In article <11m2afINNr0k@agate.berkeley.edu> ewylie@ocf.berkeley.edu (Elizabeth Wylie) writes:
- > >An undocumented feature of PBGetCatInfo allows you to pass a file number in the
- > >ioDirID field. Since this is undocumented, it could fail in the future, but
- > >because of the way the disk catalog is set up, I'd be surprised if it did.
- > >
- > >-E. Wylie
- > >
- >
- > InsideMac-IV claims that if you pass in a dirId in ioDirId and a -1
- > in ioDirIndex that it will return information about a directory. I've
- > tried the same thing with passing a fileId in the ioDirId field, and
- > it failed. My understanding is that it isn't possible for the B-tree
- > to provide access using fileIds because of the way it stores the data.
- > Am I (hopefully) wrong?
- >
- > Thanks!
- > John
-
- Just call PBResolveFileIDRef(), as documented on page 25-46 of IM VI. It
- will take a file ID and locate the appropriate file.
-
- Tim Dierks
- MacDTS, but I speak for the trees
-
-
- +++++++++++++++++++++++++++
-
- From: keith@taligent.com (Keith Rollin)
- Date: 1 Jul 92 19:57:38 GMT
- Organization: Taligent
-
- In article <27663@goofy.Apple.COM>, absurd@applelink.apple.com (Tim Dierks,
- software saboteur) writes:
- >
- > In article <2A4A0DEB.46B6@deneva.sdd.trw.com>, buckeye@spf.trw.com (John
- Wallace) writes:
- > >
- > > In article <11m2afINNr0k@agate.berkeley.edu> ewylie@ocf.berkeley.edu
- (Elizabeth Wylie) writes:
- > > >An undocumented feature of PBGetCatInfo allows you to pass a file number in
- the
- > > >ioDirID field. Since this is undocumented, it could fail in the future,
- but
- > > >because of the way the disk catalog is set up, I'd be surprised if it did.
- > > >
- > > >-E. Wylie
- > > >
- > >
- > > InsideMac-IV claims that if you pass in a dirId in ioDirId and a -1
- > > in ioDirIndex that it will return information about a directory. I've
- > > tried the same thing with passing a fileId in the ioDirId field, and
- > > it failed. My understanding is that it isn't possible for the B-tree
- > > to provide access using fileIds because of the way it stores the data.
- > > Am I (hopefully) wrong?
- > >
- > > Thanks!
- > > John
- >
- > Just call PBResolveFileIDRef(), as documented on page 25-46 of IM VI. It
- > will take a file ID and locate the appropriate file.
- >
-
- My System 7.0 File Manager knowledge is a little rusty, but I think
- PBResolveFileIDRef works only if a file thread record has been created by first
- calling PBCreateFileIDRef (see the last line of the PBResolveFileIDRef
- description). I've never actually made these calls, so if you have experience
- bearing out your comment, I'll defer to you.
-
- - --
- Keith Rollin
- Phantom Programmer
- Taligent, Inc.
-
-
- ---------------------------
-
- From: poon@parc.xerox.com (Alex Poon)
- Subject: Drawing with the mouse
- Organization: Xerox PARC
- Date: 22 Jun 92 20:56:08 GMT
-
- I have an external window in hypercard in which I want to allow users
- to draw with a mouse. The code segment is as follows:
-
- ...
- switch (event.what) {
-
- case mouseDown:
- GetMouse(&curpoint);
- MoveTo(curpoint.h,curpoint.v);
- while (StillDown()) {
- GetMouse(&curpoint);
- LineTo(curpoint.h,curpoint.v);
- }
- break;
-
- ...
- (where GetMouse(), StillDown(), MoveTo(), and LineTo() are toolbox
- routines).
-
- The problem is that the drawing turns out not to be smooth -- if I try
- drawing large circles really fast, I get triangles, squares, and other
- various polygons. Drawing with the hypercard pencil tool is smoother,
- but I do not want to use the built-in pencil tool because I need to
- do some processing while the user draws in real-time.
-
- Does anyone know of a solution? In general, what is the best way to
- draw with the mouse?
-
- Alex Poon
- poon@parc.xerox.com
-
-
-
- +++++++++++++++++++++++++++
-
- From: c9107786@frey.newcastle.edu.au (Dave Leonard)
- Date: 23 Jun 92 10:05:32 GMT
- Organization: Department of Mathematics, Uni of Newcastle, Oz.
-
- poon@parc.xerox.com (Alex Poon) writes:
-
- >I have an external window in hypercard in which I want to allow users
- >to draw with a mouse. The code segment is as follows:
-
- >The problem is that the drawing turns out not to be smooth -- if I try
- >drawing large circles really fast, I get triangles, squares, and other
- >various polygons. Drawing with the hypercard pencil tool is smoother,
- >but I do not want to use the built-in pencil tool because I need to
- >do some processing while the user draws in real-time.
-
- the problem appears to be the time for each cycle of your while loop
-
- well it seems pretty compact, maybe your compiler doesnt optimize too well
- and your code spends a bit of time in glue routines?
-
- Maybe you could hand-assemble it using inline assembly: asm { }
-
- Not being an absolute wizz at this, i couldnt tell you what to put between
- the { and } but your code looked pretty simple and should be Very easy to
- implement this way... just the while loop
-
- anybody out there want to post the asm {} bit?
-
- dave
-
- - --
- Dave Leonard, Uni of Newcastle c9107786@frey.newcastle.edu.au
- "l;ksd8721" - cat on a keyboard
-
- +++++++++++++++++++++++++++
-
- From: d88-jwa@dront.nada.kth.se (Jon W{tte)
- Organization: Royal Institute of Technology, Stockholm, Sweden
- Date: Mon, 29 Jun 1992 10:44:23 GMT
-
- > c9107786@frey.newcastle.edu.au (Dave Leonard) writes:
-
- >I have an external window in hypercard in which I want to allow users
- >to draw with a mouse. The code segment is as follows:
-
- while ( StillDown ( ) ) {
-
- GetMouse ( & pt ) ;
- LineTo ( pt . h , pt . v ) ;
- }
-
- >The problem is that the drawing turns out not to be smooth -- if I try
- >drawing large circles really fast, I get triangles, squares, and other
-
- the problem appears to be the time for each cycle of your while loop
-
- well it seems pretty compact, maybe your compiler doesnt optimize too well
- and your code spends a bit of time in glue routines?
-
- Maybe you could hand-assemble it using inline assembly: asm { }
-
-
- This is a common misconception. Trust me, the 10 or 20 instructions
- emitted by the compiler for the loop mechanics is NOTHING compared
- to the time that's spent inside the toolbox for the traps. If the
- loop looks as shown above, there isn't much more you can do unless
- you draw directly to screen (check the UMPG for such code, and a
- decent graphics book for how to draw fast lines) and even that won't
- give you toomuch of a speedup.
-
- However, the loop as it stands should be fast enough, I strongly
- believe something else is going on as well as the drawing. If you
- still can't make it work, you can't; buy a faster machine.
-
- - --
- Jon W{tte, Svartmangatan 18, S-111 29 Stockholm, Sweden
-
- "Difficult, obscure, incoherent and nonstandard does not imply more power."
- - Andrew Kass in comp.sys.mac.hardware
-
- +++++++++++++++++++++++++++
-
- From: rae@alias.com (Reid Ellis)
- Organization: Alias Research, Inc., Toronto ON Canada
- Date: Tue, 30 Jun 1992 03:48:29 GMT
-
- Dave Leonard <c9107786@frey.newcastle.edu.au> writes:
- |I have an external window in hypercard in which I want to allow users
- |to draw with a mouse. The code segment is as follows:
- |
- | while (StillDown()) {
- | GetMouse(& pt);
- | LineTo(pt . h , pt . v);
- | }
- |
- |The problem is that the drawing turns out not to be smooth -- if I try
- |drawing large circles really fast, I get triangles, squares, ...
-
- Someone else <???> writes:
- | Maybe you could hand-assemble it using inline assembly: asm { }
-
- Jon W{tte <d88-jwa@dront.nada.kth.se> writes:
- |This is a common misconception. Trust me, the 10 or 20 instructions
- |emitted by the compiler for the loop mechanics is NOTHING compared
- |to the time that's spent inside the toolbox for the traps.
-
- Would the code benefit from GetTrapAddress() to avoid the toolbox trap
- mechanism? Or does this have the unfortunate side effect of possibly
- deaccellerating and Quickdraw accellerators running?
-
- Reid
- - --
- Reid Ellis
- rae@utcs.utoronto.ca || rae@Alias.com
- CDA0610@applelink.apple.com || +1 416 362 9181 [work]
-
- +++++++++++++++++++++++++++
-
- From: cjacobs@cs.washington.edu (Charles Jacobs)
- Organization: Computer Science & Engineering, U. of Washington, Seattle
- Date: Tue, 30 Jun 92 07:53:14 GMT
-
- Dave Leonard <c9107786@frey.newcastle.edu.au> writes:
- |I have an external window in hypercard in which I want to allow users
- |to draw with a mouse. The code segment is as follows:
- |
- | while (StillDown()) {
- | GetMouse(& pt);
- | LineTo(pt . h , pt . v);
- | }
- |
- |The problem is that the drawing turns out not to be smooth -- if I try
- |drawing large circles really fast, I get triangles, squares, ...
-
- Yeah, I did the same thing a couple of weeks ago, and what helped me a lot
- was to remember the old location and only draw if it's necessary -- made a
- dramatic improvement, without resorting to yuckiness like assembly or
- other stuff I don't understand (heh)..
- try this (forgive me for the syntactic & stylistic errors that are bound
- to follow... I'm tired):
- GetMouse (& oldPt);
- while (StillDown()) {
- GetMouse(& pt);
- if (oldPt != pt) {
- LineTo (pt.h, pt.v);
- oldPt = pt
- }
- }
-
- I think that's right... anyway, you get the idea...
- chuck
-
-
-
- +++++++++++++++++++++++++++
-
- From: scott@mcl.ucsb.edu (Scott Bronson)
- Date: 1 Jul 92 17:36:19 GMT
-
- In <D88-JWA.92Jun29114423@dront.nada.kth.se> d88-jwa@dront.nada.kth.se (Jon W{tte) writes:
-
- >> c9107786@frey.newcastle.edu.au (Dave Leonard) writes:
-
- > >I have an external window in hypercard in which I want to allow users
- > >to draw with a mouse. The code segment is as follows:
-
- > while ( StillDown ( ) ) {
-
- > GetMouse ( & pt ) ;
- > LineTo ( pt . h , pt . v ) ;
- > }
-
- > >The problem is that the drawing turns out not to be smooth -- if I try
- > >drawing large circles really fast, I get triangles, squares, and other
-
-
- >However, the loop as it stands should be fast enough, I strongly
- >believe something else is going on as well as the drawing. If you
- >still can't make it work, you can't; buy a faster machine.
-
- There is a more complex technique you can try. I think Fractal Design's
- Painter uses it. Install a VBL task that queues mouse locations about
- every other tick into a large buffer. Then you are assured that the
- mouse will be polled 30 times a second, resulting in a (hopefully)
- smooth line. You can play with the number of times a second the mouse
- is polled; the larger the buffer, the more points can be stored before
- the computer catches up, and the smoother the curve.
-
- Then, your main program can simply go running through this buffer in
- a tight loop:
-
- #include<sys/stdsyntaxdisclaimer.h>
-
- Point oldpoint, mousepoint, *mp;
-
- while( StillDown() ) {
- mousepoint = *(mp++);
- if( ((long*)&mousepoint) != ((long*)&oldpoint) ) {
- oldpoint = mousepoint;
- LineTo( mousepoint );
- }
- }
-
- A circular buffer would allow you to track the mouse for as long as the
- user holds it down. Just make sure that your loop doesn't pass your VBL,
- (concievable on moderately fast machines especially with accelerated QD)
- or you'll get garbage instead of good mouse locations.
-
- - Scott
-
- +++++++++++++++++++++++++++
-
- From: mxmora@unix.SRI.COM (Matt Mora)
- Date: 1 Jul 92 16:00:44 GMT
- Organization: SRI International, Menlo Park, California
-
- In article <1992Jun30.034829.22055@alias.com> rae@alias.com (Reid Ellis) writes:
- >Dave Leonard <c9107786@frey.newcastle.edu.au> writes:
-
- >|The problem is that the drawing turns out not to be smooth -- if I try
- >|drawing large circles really fast, I get triangles, squares, ...
-
- >Would the code benefit from GetTrapAddress() to avoid the toolbox trap
- >mechanism? Or does this have the unfortunate side effect of possibly
- >deaccellerating and Quickdraw accellerators running?
-
- You could try setting the mouse tracking speed to a lower value.
- This should give a more accurate tracking of the mouse. The vbl task
- won't give you the huge delta changes that give you the triangles and
- squares. Its probably not a nice thing to do to a user but if you set it
- back to what it was before the tracking code maybe the user won't notice.
-
- Matt
-
-
-
-
-
-
-
-
-
-
-
- - --
- ___________________________________________________________
- Matthew Mora | my Mac Matt_Mora@sri.com
- SRI International | my unix mxmora@unix.sri.com
- ___________________________________________________________
-
- ---------------------------
-
- From: pgc@po.CWRU.Edu (Peter G. Cramer)
- Subject: Converting floats to strings Question
- Date: 23 Jun 92 21:02:42 GMT
- Organization: Case Western Reserve University, Cleveland, OH (USA)
-
-
- Help! I need a C function that converts a float to a string.
-
- ANSI C provides a function called "gcvt" for this purpose
- (it's part of stdlib.h), but it wasn't supplied with Think C.
- If anyone can direct me to source code for this, I would
- be eternally grateful!
-
- All the Best
- - --
- Peter G. Cramer, Physics Department, CWRU
- University Circle Cleveland, Ohio 44106
- (216) 368-3656 pgc@po.cwru.edu
-
- +++++++++++++++++++++++++++
-
- From: suitti@ima.isc.com (Stephen Uitti)
- Organization: Interactive Systems, Cambridge, MA 02138-5302
- Date: Wed, 24 Jun 1992 00:06:30 GMT
-
- In article <1992Jun23.210242.27037@usenet.ins.cwru.edu> pgc@po.CWRU.Edu (Peter G. Cramer) writes:
- >
- >Help! I need a C function that converts a float to a string.
- >
- >ANSI C provides a function called "gcvt" for this purpose
- >(it's part of stdlib.h), but it wasn't supplied with Think C.
- >If anyone can direct me to source code for this, I would
- >be eternally grateful!
-
- How about sprintf()? You can use it from ANSI-small too.
- It works for me.
-
- Stephen.
- suitti@ima.isc.com
-
- +++++++++++++++++++++++++++
-
- From: dobrohoczkim@cc4.crl.aecl.ca
- Date: 24 Jun 92 12:49:59 GMT
- Organization: AECL RESEARCH
-
- I also need to convert a float to a string and vice versa. On page 69 of
- Inside Macintoch IV it says three new routine have been added to the
- Binary-Decimal Convertion Package to do the string to SANE binary data
- format conversion and SANE binary data to string conversion. It also
- states these functions are documented in the "Apple Numerics Manual". My
- problem is that I can not get a hold of this manual. Could some kind soul
- tell me how these work or point me to some FTP'able item that would.
-
- Thanks,
-
- dobrohoczkim@crl.aecl.ca
- Michael Dobrohoczki
- Chalk River Laboratories
- Atomic Energy Canada Ltd.
-
- +++++++++++++++++++++++++++
-
- From: dowdy@apple.com (Tom Dowdy)
- Date: 1 Jul 92 19:11:20 GMT
- Organization: Apple Computer, Inc.
-
- In article <1992Jun24.000630.16121@ima.isc.com>, suitti@ima.isc.com
- (Stephen Uitti) wrote:
- > In article <1992Jun23.210242.27037@usenet.ins.cwru.edu> pgc@po.CWRU.Edu (Peter G. Cramer) writes:
- > >Help! I need a C function that converts a float to a string.
- >
- > How about sprintf()? You can use it from ANSI-small too.
- > It works for me.
-
- How about using the International Utilities instead? That way your
- application will work in places other than the US.
-
- Tom Dowdy Internet: dowdy@apple.COM
- Apple Computer MS:81KS UUCP: {sun,voder,amdahl,decwrl}!apple!dowdy
- 20525 Mariani Ave AppleLink: DOWDY1
- Cupertino, CA 95014
- "The 'Ooh-Ah' Bird is so called because it lays square eggs."
-
- ---------------------------
-
- From: rjacks@austlcm.sps.mot.com (rodney jacks)
- Subject: SOUND: Volume decreases after first command
- Organization: Motorola Inc, Austin, Texas
- Date: Thu, 25 Jun 1992 14:49:16 GMT
-
- Help,
-
- I'm having a couple of problems with the Sound Manager that I just
- can't figure out. I'm attempting to play a soundtrack by issuing
- a series of sound commands to the sound manager. Before starting
- the soundtrack, my application sets the sound volume to a particular
- volume (that was saved in a preference file) using SetSoundVol.
- When I issue the commands, the soundtrack starts to play and after
- playing the first command/sound at the new volume level, the volume
- switches back to the original volume level.
-
- If I change the volume setting while the soundtrack is already playing
- using the Set Volume menu I have provided in my app, everything
- works ok (ie. the soundtrack plays at the new volume level).
-
- Other than the volume level the soundtrack plays just fine.
-
- The other problem I have is that when the soundtrack is playing
- and I play some other sound effect in a different channel using
- SoundPlay both the sound effect and the soundtrack seem to
- decrease in volume until the sound effect is finished.
-
- I'm basically using the DTS sample code from SoundApp. I have
- added procedures for starting and stopping the soundtrack, and setting
- the volume level. I use a VBL routine to keep the soundtrack playing.
-
- I'm running on System 7.0.1 with Tuna Helper if that is important.
-
- Thanks for your help,
- - -Rodney
-
- ***********************************************************************
- ** Rodney Jacks **
- ** Motorola Inc, Austin, Texas **
- ** E-mail: rjacks@austlcm.sps.mot.com **
- ** Picard asks Worf what he thought of commanding the _Enterprise_ **
- ** "Comfortable chair." ST.TNG _The Emissary_ **
- ***********************************************************************
-
-
-
- +++++++++++++++++++++++++++
-
- From: potts@itl.itd.umich.edu (Paul Potts)
- Organization: Instructional Technology Laboratory, University of Michigan
- Date: Thu, 25 Jun 92 18:44:32 GMT
-
- In article <1992Jun25.144916.7561@oakhill.sps.mot.com> rjacks@austlcm.sps.mot.com (rodney jacks) writes:
- >Help,
- >
- <first problem left out to save space>...
- >
- >The other problem I have is that when the soundtrack is playing
- >and I play some other sound effect in a different channel using
- >SoundPlay both the sound effect and the soundtrack seem to
- >decrease in volume until the sound effect is finished.
- >
- >I'm basically using the DTS sample code from SoundApp. I have
- >added procedures for starting and stopping the soundtrack, and setting
- >the volume level. I use a VBL routine to keep the soundtrack playing.
- >
- >I'm running on System 7.0.1 with Tuna Helper if that is important.
-
- I'm uncertain about the first problem, but the second problem seems clear:
- on the Mac, the volume available for playing sampled sounds gets divided up
- between the various sampled sounds playing in different channels. If I play
- a sample in channel one and it sounds X loud, if I open up another channel
- and play another sample at the same time, the first sample will only sound
- roughly X/2 loud.
-
- I don't have a really good suggestion to get around this, other than that
- you try adjusting to a different volume level when playing sounds
- simultaneously. Remember, you've got both the sound chip amplitude (with
- setAmpCmd) and the speaker volume to work with, so it is possible to get
- fairly fine control over the sound volume levels.
-
- - --
- The essence of OOP: "With all this horse manure, I know there's got to be
- a pony in here somewhere!"
- Paul R. Potts, Software Designer --- potts@itl.itd.umich.edu <--- me!
-
- +++++++++++++++++++++++++++
-
- From: REEKES@applelink.apple.com (Jim Reekes)
- Date: 1 Jul 92 19:11:58 GMT
- Organization: Apple Computer, Inc.
-
- In article <1992Jun25.184432.23162@terminator.cc.umich.edu>, potts@itl.itd.umich.edu (Paul Potts) writes:
- >
- > In article <1992Jun25.144916.7561@oakhill.sps.mot.com> rjacks@austlcm.sps.mot.com (rodney jacks) writes:
- > >Help,
- > >
- > <first problem left out to save space>...
- > >
- > >The other problem I have is that when the soundtrack is playing
- > >and I play some other sound effect in a different channel using
- > >SoundPlay both the sound effect and the soundtrack seem to
- > >decrease in volume until the sound effect is finished.
- > >
- > >I'm basically using the DTS sample code from SoundApp. I have
- > >added procedures for starting and stopping the soundtrack, and setting
- > >the volume level. I use a VBL routine to keep the soundtrack playing.
- > >
- > >I'm running on System 7.0.1 with Tuna Helper if that is important.
-
- This is a design limitation of the Sound Manager. I'm well aware of the
- problem, and we've got a solution in the workings. Mean while, there's not
- much you can to about this. The only suggestion I can think of it try
- playing all of your channels at the same time and you'll not have the volumes
- cutting in and out. When you want one of the channels to stop playing,
- change it to a really slow rate (using the rateCmd or freqCmd) that's
- below the audible range. It's a hack and it's a gross idea, but that's
- the only suggestion I have. Just remember that mixing channels costs
- CPU time.
-
- - -----------------------------------------------------------------------
- Jim Reekes, Polterzeitgeist | Macintosh Toolbox Engineering
- | Sound Manager Expert
- Apple Computer, Inc. | RAll opinions expressed are mine, and do
- 20525 Mariani Ave. MS: 81-KS | not necessarily represent those of my
- Cupertino, CA 95014 | employer, Apple Computer Inc.S
-
-
-
- ---------------------------
-
- From: bberqu@sagpd1 ()
- Subject: Programmers Switch/Handles
- Date: Mon, 29 Jun 1992 20:28:48 GMT
-
-
- I'm new to the mac so bear with me:
-
- This is probably a really stupid question, but I can't seem to find it in
- the manual, how do you reset and interrupt the mac on an LC II, I was
- reading in my Macsbug manual that the functionality for the programmers
- switch is built into the keyboard (what is the key combination or whatever)?
-
- This one's for programmers, when creating a window can I use a Handle for
- the wStorage parameter in the call to GetNewWindow, if I use a pointer
- everything works fine, but if I create it with a Handle, this causes me
- problems later on in the program for instance in another subroutine after
- the window is created I make a call to sprintf to format some data (this
- causes the mac to lockup), I'm not doing anything (that I know of) to
- the memory obtained by the handle when I make the call to sprintf,
- this works just fine by using pointers instead of handles. Is it OK
- to use relocatable blocks for window records?
-
- This is how I call GetNewWindow with a handle:
-
- wptr = GetNewWindow ( WINDOWID, *handle, .....
-
- You can email your responses.
-
- Thanks Brian
-
- P.S. I hope I don't get alot of rtfm's, because I have been.
-
- +++++++++++++++++++++++++++
-
- From: fullerto@tuna.cis.ohio-state.edu (timothy dwight fullerton)
- Organization: The Ohio State University, Department of Computer and Information Science
- Date: Tue, 30 Jun 1992 01:35:18 GMT
-
-
- Brian,
-
- Under system 7, you can interrupt with [cmd]-[option]-[esc].
-
- I am running system 6 on an LC I, and my reboot is [cmd]-[ctrl]-
- [power on]. There also exists a programmers switch init which I use (just
- in case you prefer system 6 also) that is shareware. I am not at home, and
- I cannot remember off the top of my head the author and version, but you
- should be able to get it from FTP sites or compuserve. If not, and you need
- it, send me mail.
-
- By the way, it was six months before I learned this info. It would
- be nice if Apple would put it in our LC manuals, wouldn't it?
-
- good luck,
- Tim Fullerton
-
- fullerto@cis.ohio-state.edu
-
- 75720.142@compuserve.com
-
- +++++++++++++++++++++++++++
-
- From: pegasus@leland.Stanford.EDU (Betty Lee)
- Organization: Stanford University -- Electrical Engineering
- Date: Tue, 30 Jun 1992 03:20:27 GMT
-
- fullerto@tuna.cis.ohio-state.edu (timothy dwight fullerton) writes:
-
- + Under system 7, you can interrupt with [cmd]-[option]-[esc].
-
- Uh, that's not an interrupt. That's a force-quit to the application.
- If you have MacsBug, interrupt should be <cmd>-<power> on the new Macs.
- (Sorry, I can't find the original article, so I'm just responding to this
- one.) It worked for me in both System 6 AND System 7, so I think it's a
- hardware feature.
-
- + I am running system 6 on an LC I, and my reboot is [cmd]-[ctrl]-
- + [power on]. There also exists a programmers switch init which I use (just
- + in case you prefer system 6 also) that is shareware. I am not at home, and
- + I cannot remember off the top of my head the author and version, but you
- + should be able to get it from FTP sites or compuserve. If not, and you need
- + it, send me mail.
-
- It's on sumex-aim.Stanford.EDU under /info-mac/ex/programmers-key-142.hqx.
- >From the doc...
- Programmer's Key was written by:
- Paul Mercer
- AppleLink: MERCER1
- Internet: pmercer@apple.com
- P.O. Box 160165
- Cupertino, CA 95014-0165
-
- + By the way, it was six months before I learned this info. It would
- + be nice if Apple would put it in our LC manuals, wouldn't it?
-
- Aw... But that would take all the fun out of learning all these neat
- tricks by yourself! It's little things like that which separate the REAL
- computer enthusiasts from the theorists who can get a BS in CS and know
- nothing practical whatsoever. I know FOOD RESEARCH majors who can put any
- computer to better use than some CS grads. (Then again, I might be feeling
- inferior because I have no interest in matrices, encryption techniques,
- inductive proofs, and prime number generating algorithms... NOT!)
-
- - --
- Betty Lee | The main difference between a User and a Hacker:
- P. O. Box 5748 | A User buys a faster computer to spend
- Stanford, CA 94309 | _less_ time with it. Happy hacking!
- Pegasus@Leland.Stanford.EDU | -- From rec.humor.funny
-
- +++++++++++++++++++++++++++
-
- From: zben@ni.umd.edu (Charles B. Cranston)
- Organization: UM Home for the Terminally Analytical
- Date: Tue, 30 Jun 1992 18:35:18 GMT
-
- Nobody answered his other question, and I don't think I can get email
- back to an address like bberqu@sagpd1 (:-o) so:
-
- In article <1992Jun29.202848.11057@sagpd1>, bberqu@sagpd1 () writes:
-
- > This one's for programmers, when creating a window can I use a Handle for
- > the wStorage parameter in the call to GetNewWindow, if I use a pointer
- > everything works fine, but if I create it with a Handle, this causes me
- > problems later on in the program...
-
- You can't put a GrafPort or anything containing a GrafPort in a handle
- because the data in handles can move around and the Macintosh just can't
- handle GrafPorts moving around. Note that there is a GrafPort in a
- Window and there is a Window in a Dialog so you cannot put any of these
- things into a handle.
-
- Exception: you could leave the handle locked during the whole time these
- things are being used, then pass a pointer (the CONTENTS of the handle)
- to the routines which usually take a pointer to storage. This might be
- useful if you have a huge number of windows of which only some are actually
- being used at any one time, and any one window is only used for a short
- time so the locking of the handles wouldn't cause long-term fragmentation.
- Note that just hiding the window will not do, you would have to get it
- out of the window chain entirely before you could allow the handle to
- become unlocked. This means you would have to destroy the window...
-
- What I tend to do is allocate a static global array of Dialogs and have
- init code chain them together into a free list, then allocate and
- deallocate from this free list. The only problem is that the maximum
- number of Dialogs is fixed at compile time. One could compute at init
- time the maximum number of windows and allocate a nonrelocatable block
- containing all the window space and allocate it the same way. I don't
- think this would be much different, however, from just letting the
- system allocate and free the blocks by passing nil for wStorage.
-
-
-
- +++++++++++++++++++++++++++
-
- From: keith@taligent.com (Keith Rollin)
- Date: 30 Jun 92 18:30:59 GMT
- Organization: Taligent
-
- In article <1992Jun29.202848.11057@sagpd1>, bberqu@sagpd1 writes:
- >
- > This one's for programmers, when creating a window can I use a Handle for
- > the wStorage parameter in the call to GetNewWindow, if I use a pointer
- > everything works fine, but if I create it with a Handle, this causes me
- > problems later on in the program for instance in another subroutine after
- > the window is created I make a call to sprintf to format some data (this
- > causes the mac to lockup), I'm not doing anything (that I know of) to
- > the memory obtained by the handle when I make the call to sprintf,
- > this works just fine by using pointers instead of handles. Is it OK
- > to use relocatable blocks for window records?
- >
- > This is how I call GetNewWindow with a handle:
- >
- > wptr = GetNewWindow ( WINDOWID, *handle, .....
-
- Technote #155 talks about this. Essentially, it says don't do it.
-
- - --
- Keith Rollin
- Phantom Programmer
- Taligent, Inc.
-
-
- +++++++++++++++++++++++++++
-
- From: keith@taligent.com (Keith Rollin)
- Date: 1 Jul 92 17:24:01 GMT
- Organization: Taligent
-
- In article <1992Jun30.183518.22176@ni.umd.edu>, zben@ni.umd.edu (Charles B.
- Cranston) writes:
- >
- > Nobody answered his other question, and I don't think I can get email
- > back to an address like bberqu@sagpd1 (:-o) so:
- >
- > In article <1992Jun29.202848.11057@sagpd1>, bberqu@sagpd1 () writes:
- >
- > > This one's for programmers, when creating a window can I use a Handle for
- > > the wStorage parameter in the call to GetNewWindow, if I use a pointer
- > > everything works fine, but if I create it with a Handle, this causes me
- > > problems later on in the program...
- >
- > You can't put a GrafPort or anything containing a GrafPort in a handle
- > because the data in handles can move around and the Macintosh just can't
- > handle GrafPorts moving around. Note that there is a GrafPort in a
- > Window and there is a Window in a Dialog so you cannot put any of these
- > things into a handle.
- >
- > Exception: you could leave the handle locked during the whole time these
- > things are being used, then pass a pointer (the CONTENTS of the handle)
- > to the routines which usually take a pointer to storage. This might be
- > useful if you have a huge number of windows of which only some are actually
- > being used at any one time, and any one window is only used for a short
- > time so the locking of the handles wouldn't cause long-term fragmentation.
- > Note that just hiding the window will not do, you would have to get it
- > out of the window chain entirely before you could allow the handle to
- > become unlocked. This means you would have to destroy the window...
-
- I just wanted to clarify what Ben means by leaving "the handle locked during the
- whole time these things are being used." Be sure that the handle is locked
- during the ENTIRE EXISTANCE of the window. That is, it is _not_ OK to do
- something like:
-
- HLock((Handle) myWindowHandle);
- SetPort(*myWindowHandle);
- UpdateMyWindow(myWindowHandle);
- SetPort(mySafeDummyPort);
- HUnlock((Handle) myWindowHandle);
-
- After the grafPort within the window record is created, it MUST NOT MOVE! See
- Technote #155 for an explanation.
-
- Since the window record must be locked during its entire existance, you might
- was well create it as a non-relocatable block in the first place.
-
- - --
- Keith Rollin
- Phantom Programmer
- Taligent, Inc.
-
-
- ---------------------------
-
- From: aep@world.std.com (Andrew E Page)
- Subject: Calling Apple Events from an Init/CDEV?
- Organization: The World Public Access UNIX, Brookline, MA
- Date: Tue, 30 Jun 1992 12:15:47 GMT
-
-
- Is it possible to call Apple Events from an INIT/CDEV? I'm working
- on something that might otherwise require a DRVR, but I think that
- Apple Events might be friendlier to some components of the project.
-
- DoD# 0581 1990 Suzuki VX800 MSF Intro Class Aug 1990
- - --
- Andrew E. Page CTO(Warrior Poet)| Decision and Effort The Archer and Arrow
- DSP Ironworks | The difference between what we are
- Macintosh and DSP Technology | and what we want to be.
-
- +++++++++++++++++++++++++++
-
- From: grobbins@Apple.COM (Grobbins)
- Date: 30 Jun 92 18:12:57 GMT
- Organization: Guillermo's Group
-
- In article <BqnrEC.446@world.std.com> aep@world.std.com (Andrew E Page) writes:
- > Is it possible to call Apple Events from an INIT/CDEV?
-
- It's not a good idea, but you can use the PPC Toolbox to have your
- INIT communicate with a background application which serves as the
- host and target for the Apple events. For an example, see the
- sample aecdev-aedaemon.hqx in the directory
-
- dts/mac/sc/snippets/toolbox.iac/apple.events
-
- on ftp.apple.com
-
-
- Grobbins grobbins@apple.com
-
- Usual disclaimers apply
-
-
- +++++++++++++++++++++++++++
-
- From: greggor@Apple.COM (Greg L. Anderson)
- Date: 30 Jun 92 19:07:34 GMT
- Organization: Apple Computer Inc., Cupertino, CA
-
- In article <BqnrEC.446@world.std.com> aep@world.std.com (Andrew E Page) writes:
- > Is it possible to call Apple Events from an INIT/CDEV?
-
- You may AESend from a CDEV/CODE resource. If you never call WaitNextEvent/
- GetNextEvent, you won't be able to receive a reply, though.
-
- - --
- ===================== =========================== =====================
- Greg Anderson Apple Computer, Inc. O Ponnuki O
- Macintosh Bodhisattva Macintosh System Software O O is ideal O O
- greggor@apple.com Finder Team O shape O
- ===================== =========================== =====================
-
- +++++++++++++++++++++++++++
-
- From: ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University)
- Date: 2 Jul 92 03:31:42 GMT
- Organization: University of Waikato, Hamilton, New Zealand
-
- In article <69457@apple.Apple.COM>, greggor@Apple.COM (Greg L. Anderson) writes:
- > In article <BqnrEC.446@world.std.com> aep@world.std.com (Andrew E Page) writes:
- >> Is it possible to call Apple Events from an INIT/CDEV?
- >
- > You may AESend from a CDEV/CODE resource.
-
- Just to amplify on this, you may call AESend from a cdev resource, *only*
- because you're running in the Finder's context, and the Finder is high-level-
- event aware. AESend doesn't work from the context of an application that isn't
- high-level-event aware.
-
- Lawrence
- been there, done that
-
- +++++++++++++++++++++++++++
-
- From: jeremyr@dcs.qmw.ac.uk (Jeremy Roussak)
- Date: 1 Jul 92 20:43:24 GMT
- Organization: Computer Science Dept, QMW, University of London
-
- In <69450@apple.Apple.COM> grobbins@Apple.COM (Grobbins) writes:
-
- >> Is it possible to call Apple Events from an INIT/CDEV?
-
- >It's not a good idea, but you can use the PPC Toolbox to have your
- >INIT communicate with a background application which serves as the
- >host and target for the Apple events.
-
- Why is this not a good idea? It seems to be the only way in
- which this most useful task can be accomplished.
-
- Jeremy
-
- +++++++++++++++++++++++++++
-
- From: grobbins@Apple.COM (Grobbins)
- Date: 2 Jul 92 09:29:51 GMT
- Organization: Apple CTS
-
- In article <1992Jul1.204324.24456@dcs.qmw.ac.uk> jeremyr@dcs.qmw.ac.uk (Jeremy Roussak) writes:
- >In <69450@apple.Apple.COM> grobbins@Apple.COM (Grobbins) writes:
- >>> Is it possible to call Apple Events from an INIT/CDEV?
- >>It's not a good idea, but you can use the PPC Toolbox to have your
- >>INIT communicate with a background application which serves as the
- >>host and target for the Apple events.
- >Why is this not a good idea? It seems to be the only way in
- >which this most useful task can be accomplished.
-
- Sorry, I wrote that badly. Sending an Apple event from a stand-alone
- code resource is not a good idea. Setting up a PPC link between
- a code resource and an application and having the application send
- the Apple event is a good idea, and is the DTS-sanctioned way to do
- this.
-
- Grobbins grobbins@apple.com
-
- Usual disclaimers apply.
-
- ---------------------------
-
- End of C.S.M.P. Digest
- **********************
-